package com;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Start extends JFrame {
    int x=0;
Start(){
    this.setLayout(null);
    this.setTitle("我在十年后等你");
    JLabel jl = new JLabel("欢迎你，游戏者");
    JButton jb = new JButton("继续");
    jl.setBounds(120,30,300,50);
    jb.setBounds(140,100,100,30);
    this.add(jb);
    this.add(jl);
    this.setBounds(450,200,400,200);
    this.setVisible(true);
    this.setResizable(false);


    jb.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            switch (x){
                case 0:jl.setText("接下来由我说明游戏规则");x++;break;
                case 1:jl.setText("游戏中你必须去收集宝箱");x++;break;
                case 2:jl.setText("只有收集足够的宝箱");x++;break;
                case 3:jl.setText("才能打开下一层的门");x++;break;
                case 4:jl.setText("不过要注意四周潜伏的怪兽");x++;break;
                case 5:jl.setText("你可以择战斗或者逃跑");x++;break;
                case 6:jl.setText("胜利你将获得两个宝箱");x++;break;
                case 7:jl.setText("失败你将失去两个宝箱");x++;break;
                case 8:jl.setText("逃跑你将失去一个宝箱");x++;break;
                case 9:jl.setText("如果你的宝箱数在零以下");x++;break;
                case 10:jl.setText("你将死亡，请注意");x++;break;
                case 11:jl.setText("为了你的安全");x++;break;
                case 12:jl.setText("我将在每一层送你两个");x++;break;
                case 13:jl.setText("以上就是游戏规则");x++;break;
                case 14:jl.setText("那么开始游戏吧");jb.setText("开始游戏");x++;break;
                case 15: setVisible(false);
                     GameWindows win2 = new GameWindows();
                    Thread thread=new Thread(win2);
                    thread.start();
            }
        }
    });
}

    public static void main(String[] args) {
        new Start();
    }
}
